package infra.adapter.projectDAO;

import infra.dao.project.ProjectDAO;
import java.io.File;
import models.Project;

public class ProjectDAOAdapter {

    private ProjectDAO newProject;

    public ProjectDAOAdapter() {
        newProject = ProjectDAO.getInstance();
    }
    
    public void createProject(Project project) {
        if (newProject.folderExists(project.getName())) {
            // get out of the method with some message.
        } else {
            newProject.createProject(project);
        }
    }
    
    public File retrieveProjectByTitle(String title) {
        return newProject.retrieveProjectByTitle(title);
    }
    
    public void updateProject(String oldSubPath, String newSubPath) {
        if (newProject.folderExists(oldSubPath)) {
            newProject.updateProject(oldSubPath, newSubPath);
        }
    }
    
    public void deleteProject(String subPath) {
        if (newProject.folderExists(subPath)) newProject.deleteProject(subPath);
    }
}
